package com.seventh.associationsystem.util;

import org.springframework.data.domain.Sort;

public class PageUtils {

    public static Sort getOrders(String pageSortField, String pageSortDirection) {
        if (pageSortField != null)
            if (pageSortDirection.compareToIgnoreCase("desc") == 0)
                return new Sort(Sort.Direction.DESC, pageSortField);
            else
                return new Sort(Sort.Direction.ASC, pageSortField);
        else
            return new Sort(Sort.Direction.ASC, "name");
    }
}
